<?php if (!defined('THINK_PATH')) exit();?>
<!-- saved from url=(0081)http://www.chuangyixingnong.com/index.php?s=/mob/weibo/forward/id/19/uid/162.html -->
<html class="js cssanimations">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">

</head>
    <body>
    <button title="Close (Esc)" type="button" class="mfp-close" style="display: none;">×</button>
     <input name="longitude" type="hidden" id="longitude"  />
     <input name="latitude" type="hidden" id="latitude"  />
     <input name="studentId" type="hidden" id="studentId" value="<?php echo ($student["studentId"]); ?>"  />

    <div class="" id="my-repost" style="width:95%;margin:0 auto; ">
        <div class="am-modal-dialog">
            <div class="am-modal-bd">


                <div style="height:500px;">
   <div id="container" ></div>


<script>

  // JavaScript Document

    var map, geolocation;

var cluster, markers = [],markers1 = [];
  //加载地图，调用浏览器定位服务

  map = new AMap.Map('container', {
      resizeEnable: true,
       center:['<?php echo ($student["longitude"]); ?>','<?php echo ($student["latitude"]); ?>'],
      zoom:16
  });

  var auto = new AMap.Autocomplete({
      input: "tipinput"
  });
  AMap.event.addListener(auto, "select", select);//注册监听，当选中某条记录时会触发
  function select(e) {
      if (e.poi && e.poi.location) {
          map.setZoom(16);
          map.setCenter(e.poi.location);

      }

  }

  var marker0 = new AMap.Marker({
      position: map.getCenter(),
      draggable: true,
      cursor: 'move',
      raiseOnDrag: true
  });
  marker0.setMap(map);  //在地图上添加点
  var clickEventListener = map.on('click', function(e) {
      marker0.setMap(null);
      marker0 = new AMap.Marker({
          position: e.lnglat,
          draggable: true,
          cursor: 'move',
          raiseOnDrag: true
      });
      marker0.setMap(map);  //在地图上添加点
      marker0.setAnimation('AMAP_ANIMATION_DROP');
    document.getElementById('longitude').value=marker0.getPosition().getLng();
    document.getElementById('latitude').value=marker0.getPosition().getLat();


  });



        //实例化marker


    function markerClick(e) {
        infoWindow.setContent(e.target.content);
        infoWindow.open(map, e.target.getPosition());
    }
    function dianji(q,suoyin) {
        var infoWindow1 = new AMap.InfoWindow({
            isCustom: true,  //使用自定义窗体
            content:createInfoWindow(q,suoyin),
            offset: new AMap.Pixel(14,-80)
        });
        var position=[parseFloat(zhidaoxinxi[dianbiaojisuoyin[suoyin][2]]['longitude']),parseFloat(zhidaoxinxi[dianbiaojisuoyin[suoyin][2]]['latitude'])];
        infoWindow1.open(map, position);
    }
    function dianji1(dangqianyeshu,suoyin) {
        var infoWindow1 = new AMap.InfoWindow({
            isCustom: true,  //使用自定义窗体
            content:createInfoWindow1(dangqianyeshu,suoyin),
            offset: new AMap.Pixel(14,-80)
        });
        infoWindow1.open(map,[cluster[ming][suoyin][ming01][0][ming03].position.lng,cluster[ming][suoyin][ming01][0][ming03].position.lat]);
    }





    //关闭信息窗体
    function closeInfoWindow() {
        map.clearInfoWindow();
        addmarker1();
      }

    function getItemsArr(obj,idx)
    {
        var i=0;
        for(var item in obj)
        {
            i=i+1;
            if (i==idx){
                break;
            }
        }
        return item;
    }

  function quxiao(){

          $('.mfp-close').click();
  }
</script>



           <div >


               <button class=" am-u-sm-6" type="button" id="cancel"  style="position:relative; top:400px;background-color: #F8F8F8;padding: 12px;border: 0px;color: #000" onClick="quxiao()">
                   <span>取消</span></button>
               <button class="am-u-sm-6" type="button" id="conf"  style="position:relative; top:400px;background-color: #0e90d2;padding: 12px;border: 0px;color: #FFFFFF" >
                   <span>确定</span></button>
           </div>
            </div>
            </div>
        </div>
    </div>




<script>
$('#conf').bind('click',function(){

  longitude=document.getElementById('longitude').value;
  latitude=document.getElementById('latitude').value;
  studentId=document.getElementById('studentId').value;
   url = "<?php echo U('Mob/Student/resetDormLocation');?>";

    $.post(url, {longitude:longitude,latitude:latitude,studentId:studentId}, function (msg) {
                if (msg.status == 1) {
                   toast.success(msg.msg);
                   $('.mfp-close').click();

                } else {
                    toast.error(msg.msg);

                }
            }, 'json')




});
</script>


</body></html>